using System;
using System.Collections.Generic;
using CodePlex.DnD4eCampaignManager.DnD4e.Interfaces;

namespace CodePlex.DnD4eCampaignManager.DnD4e
{
    public class StoryArc : IEquatable<StoryArc>, IStoryArc
    {
        public List<string> ComponentArcNames { get; set; }
        public string Description { get; set; }
        public string Locations { get; set; }
        public string Name { get; set; }
        public string NonPlayerCharacters { get; set; }
        public string Rewards { get; set; }
        public string Trigger { get; set; }

        public override bool Equals(object obj)
        {
            if ( ReferenceEquals(null, obj) )
            {
                return false;
            }
            if ( ReferenceEquals(this, obj) )
            {
                return true;
            }
            if ( obj.GetType() != typeof ( StoryArc ) )
            {
                return false;
            }
            return Equals((StoryArc) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = ( Name != null ? Name.GetHashCode() : 0 );
                result = ( result * 397 ) ^ ( ComponentArcNames != null ? ComponentArcNames.GetHashCode() : 0 );
                result = ( result * 397 ) ^ ( Description != null ? Description.GetHashCode() : 0 );
                result = ( result * 397 ) ^ ( Locations != null ? Locations.GetHashCode() : 0 );
                result = ( result * 397 ) ^ ( NonPlayerCharacters != null ? NonPlayerCharacters.GetHashCode() : 0 );
                result = ( result * 397 ) ^ ( Rewards != null ? Rewards.GetHashCode() : 0 );
                result = ( result * 397 ) ^ ( Trigger != null ? Trigger.GetHashCode() : 0 );
                return result;
            }
        }

        public bool Equals(StoryArc obj)
        {
            if ( ReferenceEquals(null, obj) )
            {
                return false;
            }
            if ( ReferenceEquals(this, obj) )
            {
                return true;
            }
            return Equals(obj.Name, Name) && Equals(obj.ComponentArcNames, ComponentArcNames) && Equals(obj.Description, Description) &&
                   Equals(obj.Locations, Locations) && Equals(obj.NonPlayerCharacters, NonPlayerCharacters) && Equals(obj.Rewards, Rewards) &&
                   Equals(obj.Trigger, Trigger);
        }

        public static bool operator ==(StoryArc left, StoryArc right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(StoryArc left, StoryArc right)
        {
            return !Equals(left, right);
        }
    }
}